package com.ddtech.framework.system.rest;

import com.ddtech.framework.system.model.SysSpecialty;
import com.ddtech.framework.system.service.SysSpecialtyService;
import com.ddtech.framework.system.service.dto.SysSpecialtyQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@Api(tags = "系统-专业管理")
@RestController
@RequestMapping("api")
public class SysSpecialtyController {
    @Autowired
    private SysSpecialtyService sysSpecialtyService;

    @ApiOperation(value = "查询专业树")
    @GetMapping(value = "specialty/tree")
    public ResponseEntity getTree(SysSpecialtyQuery chapterQuery) {
        return new ResponseEntity(sysSpecialtyService.getTree(chapterQuery), HttpStatus.OK);
    }

    @ApiOperation(value = "新增专业树")
    @PostMapping(value = "specialty/create")
    public ResponseEntity create(@RequestBody SysSpecialty sysSpecialty) {
        sysSpecialtyService.create(sysSpecialty);
        return new ResponseEntity(HttpStatus.OK);
    }

    @ApiOperation(value = "删除专业树")
    @PostMapping(value = "specialty/del/{id}")
    public ResponseEntity del(@PathVariable String id) {
        sysSpecialtyService.del(id);
        return new ResponseEntity(HttpStatus.OK);
    }
}
